package com.example.lending.ViewModel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.example.lending.Model.Borrow;
import com.example.lending.ViewModel.Repository.BookReposity;
import com.example.lending.ViewModel.Repository.BorrowRepository;

import java.util.List;

public class BorrowViewModel extends AndroidViewModel {
    private BorrowRepository borrowRepository;

    public BorrowViewModel(@NonNull Application application) {
        super(application);
        borrowRepository = new BorrowRepository(application);
    }
    public void insertBorrows(Borrow... borrows){borrowRepository.insertBorrows(borrows);}
    public void updataBorrows(Borrow... borrows){borrowRepository.updataBorrows(borrows);}
    public void deleteBorrows(Borrow... borrows){borrowRepository.deleteBorrows(borrows);}
    public void deleteAllBorrows(Void... voids){borrowRepository.deleteAllBorrows();}
    public LiveData<List<Borrow>>getAllBorrowLive(){return borrowRepository.getAllBorrowLive();}
    public LiveData<List<Borrow>>findBorrowWithPattern(String a){return borrowRepository.findBorrowWithPattern(a);}
}
